﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="EditCommentMovie.aspx.cs" Inherits="EditCommentMovie" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:FormView ID="FormView1" runat="server" DataKeyNames="CommentID,MovieID" 
        DataSourceID="SqlDataSource1">
        <EditItemTemplate>
            CommentID:
            <asp:Label ID="CommentIDLabel1" runat="server" 
                Text='<%# Eval("CommentID") %>' />
            <br />
            Comment:
            <asp:TextBox ID="CommentTextBox" runat="server" Text='<%# Bind("Comment") %>' />
            <br />
            MovieID:
            <asp:Label ID="MovieIDLabel1" runat="server" Text='<%# Eval("MovieID") %>' />
            <br />
            Title:
            <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
            <br />
            Description:
            <asp:TextBox ID="DescriptionTextBox" runat="server" 
                Text='<%# Bind("Description") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Aktualisieren" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Abbrechen" />
        </EditItemTemplate>
        <InsertItemTemplate>
            Comment:
            <asp:TextBox ID="CommentTextBox" runat="server" Text='<%# Bind("Comment") %>' />
            <br />
            Title:
            <asp:TextBox ID="TitleTextBox" runat="server" 
                Text='<%# Bind("Title") %>' />
            <br />

            Description:
            <asp:TextBox ID="DescriptionTextBox" runat="server" 
                Text='<%# Bind("Description") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Einfügen" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Abbrechen" />
        </InsertItemTemplate>
        <ItemTemplate>
            CommentID:
            <asp:Label ID="CommentIDLabel" runat="server" Text='<%# Eval("CommentID") %>' />
            <br />
            Comment:
            <asp:Label ID="CommentLabel" runat="server" Text='<%# Bind("Comment") %>' />
            <br />
            MovieID:
            <asp:Label ID="MovieIDLabel" runat="server" 
                Text='<%# Eval("MovieID") %>' />
            <br />
            Title:
            <asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' />
            <br />
            Description:
            <asp:Label ID="DescriptionLabel" runat="server" 
                Text='<%# Bind("Description") %>' />
            <br />

        </ItemTemplate>
    </asp:FormView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" 
        
        SelectCommand="SELECT Comment.CommentID, Comment.Comment, Movie.MovieID, Movie.Title, Movie.Description FROM Comment INNER JOIN Movie ON Comment.MovieID = Movie.MovieID WHERE (Comment.CommentID = @CommentID)">
        <SelectParameters>
            <asp:QueryStringParameter Name="CommentID" QueryStringField="CommentID" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:TextBox ID="txt_comment" runat="server"></asp:TextBox>
    <asp:Button ID="btn_submit" runat="server" Text="Save Comment" 
        onclick="btn_submit_Click" />
</asp:Content>

